package com.example.phonestore.util;

public class JsonResult {

    private Integer code;

    private String msg;

    private Object data;


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "JsonResult{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public JsonResult() {
        super();
    }



    public static JsonResult success(){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode(200);
        jsonResult.setMsg("成功！");
        jsonResult.setData(null);
        return jsonResult;

    }

    public static JsonResult fail(){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode(500);
        jsonResult.setMsg("失败！");
        jsonResult.setData(null);
        return jsonResult;
    }

}


